#pragma once
#include "BlueprintScriptLibrary/RegistAction.h"
#include "GraphBase.h"

class FunctionGraph : public GraphBase
{
public:
    FunctionGraph():GraphBase() {}
    bool OnInit();
    void InitParaPin();
    virtual void ParseXmlElement(class TiXmlElement* ele);
    virtual void LoadXmlElement(class TiXmlElement* ele);
    bool SetAttribute(const char* attrName, const char* attrVal);
    void OnDraw();

    virtual void onMouseButtonDown(int button, int x, int y);
    void onMouseMove(int x, int y);
    void onMouseButtonUp(int button, int x, int y);
    BlueprintScriptLibrary::Class* GetClass();
    Vec2vbi GetOutputPinPos(int index);
    VarBaseInt GetInputParaNum();
    VarBaseInt GetOuputResultNum();
    GraphBase* CreateGraph(std::string sControlClassName);
    GraphBase* FindGraphById(int id);
    void Execute();
    FunctionPin* GetFunctionPin(std::string funcName);
    void ConnectTo(GraphBase* graph, int index);

    std::vector<GraphBase*> allNodes;
    class InputPin* ip{nullptr};
    class OutputPin* op{nullptr};

    std::vector<class InputParaPin*> ipp;
    std::vector<class OutputParaPin*> opp;

};
RegisterBlueprintClass(FunctionGraph)
